﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using NOAH.CMS.Repository;

/// <summary>
/// Summary description for ReportHelper
/// </summary>
public class ReportHelper
{

    List<Config> all = new List<Config>();

    public ReportHelper()
    {
        using (ConfigRepository configRepository = new ConfigRepository())
        {
            all = configRepository.GetAll();
        }
    }

    public string GetValue(ConfigKeyEnum key)
    {
        Config config = new Config();
        string value = "";
        if (key == ConfigKeyEnum.Report_Department)
        {
            config = all.Find(p => p.Key == ConfigKey.ReportDepartment);
            if (config != null) value = Util.StripTagsRegex(config.Value);
        }
        if (key == ConfigKeyEnum.Report_Manage_Department)
        {
            config = all.Find(p => p.Key == ConfigKey.ReportManageDepartment);
            if (config != null) value = Util.StripTagsRegex(config.Value);
        }
        if (key == ConfigKeyEnum.Website_Footer)
        {
            config = all.Find(p => p.Key == ConfigKey.WebsiteFooter);
        }
        if (key == ConfigKeyEnum.Theme)
        {
            config = all.Find(p => p.Key == ConfigKey.Theme);
            if (config != null) value = Util.StripTagsRegex(config.Value);
        }
        return value;
    }
}